package leetcode_core.test;

import java.net.DatagramPacket;
import java.net.DatagramSocket;

/**
 * 功能描述
 *
 * @author: 张庭杰
 * @date: 2022年10月15日 15:50
 */
public class UDPClient {
    public static void main(String[] args) throws Exception {
        DatagramSocket client = new DatagramSocket(9999);
        byte[] data = new byte[1024];
        DatagramPacket packet = new DatagramPacket(data,data.length);
        System.out.println("-------waiting-----");
        client.receive(packet);
        System.out.println(new String(data,0,packet.getLength()));
        client.close();
    }
}
